package com.kh.pajx.sop.service.user.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.kh.pajx.sop.base.BaseServiceImpl;
import com.kh.pajx.sop.dao.user.ISysOutsideUserDao;
import com.kh.pajx.sop.domain.PageBean;
import com.kh.pajx.sop.domain.SysOutsideUser;
import com.kh.pajx.sop.service.user.ISysOutsideUserService;
import com.kh.pajx.sop.util.page.QueryHelper;

/**
 * 外部用户业务逻辑实现类
 * @author:	azzcsimp
 * @Createdate:	2014年7月21日 下午10:10:33
 */
@Service
@Transactional
public class SysOutsideUserServiceImpl extends BaseServiceImpl<SysOutsideUser> implements ISysOutsideUserService {

	@Resource
	private ISysOutsideUserDao sysOutsideUserDao;
	
	// ==>1.ISysOutsideUserService重载方法
	
	@Override
	public List<SysOutsideUser> findUserListByType(int userType) throws Exception {
		return findUserListByType(userType, 1);
	}
	
	@Override
	public List<SysOutsideUser> findUserListByType(int userType, int userStatus) throws Exception {
		return sysOutsideUserDao.findUserListByType(userType, userStatus);
	}
	
	
	// ==>2.IbaseService重载方法
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	// =========================以下为需要整理或废弃方法===================================	
	
	@Override
	public boolean checkPhone(String phone,String uId){
		List<SysOutsideUser> list = sysOutsideUserDao.getUserByPhone(phone);
		if(list!=null && list.size()>0){
			for (SysOutsideUser sysOutsideUser : list) {
				if(sysOutsideUser.getOsuId().equals(uId)){
					return true;
				}
			}
			return false;
		}else{
			return true;
		}
	}
	
	@Override
	public List<SysOutsideUser> getUserByAreaCode(String areaCode){
		return sysOutsideUserDao.getUserByAreaCode(areaCode);
	}
	
	@Override
	public List<SysOutsideUser> getUserByAreaCode(String areaCode, int statusFlag){
		return sysOutsideUserDao.getUserByAreaCode(areaCode, statusFlag);
	}
	
	@Override
	public List<SysOutsideUser> getUserByAreaCode(String areaCode,int osuType, int statusFlag){
		return sysOutsideUserDao.getUserByAreaCode(areaCode,osuType, statusFlag);
	}
	
	@Override
	public List getSimpleUserByAreaCode(String areaCode){
		return sysOutsideUserDao.getSimpleUserByAreaCode(areaCode);
	}
	
	@Override
	public List getSimpleUserByAreaCode(String areaCode, int statusFlag){
		return sysOutsideUserDao.getSimpleUserByAreaCode(areaCode, statusFlag);
	}
	
	@Override
	public List getSimpleUserByAreaCode(String areaCode, int osuType, int statusFlag){
		return sysOutsideUserDao.getSimpleUserByAreaCode(areaCode,osuType, statusFlag);
	}
	
	/**
	 * 查询所有外部对象列表
	 * @see com.kh.pajx.sop.base.BaseServiceImpl#findAll()
	 */
	@Override
	public List<SysOutsideUser> findAll() {
		return sysOutsideUserDao.findAll();
	}
	
	/**
	 * 保存外部用户对象
	 * @see com.kh.pajx.sop.base.BaseServiceImpl#save(java.lang.Object)
	 */
	@Override
	public void save(SysOutsideUser demo) {
		sysOutsideUserDao.save(demo);
	}
	
	/**
	 * 更新外部用户对象
	 * @see com.kh.pajx.sop.base.BaseServiceImpl#update(java.lang.Object)
	 */
	@Override
	public void update(SysOutsideUser demo) {
		sysOutsideUserDao.update(demo);
	}
	
	/**
	 * 删除外部用户对象
	 * @see com.kh.pajx.sop.base.BaseServiceImpl#delete(java.lang.String)
	 */
	@Override
	public void delete(String id) {
		sysOutsideUserDao.delete(id);
	}
	
	/**
	 * 加载外部用户对象
	 * @see com.kh.pajx.sop.base.BaseServiceImpl#getById(java.lang.Long)
	 */
	@Override
	public SysOutsideUser getById(String id) {
		return sysOutsideUserDao.getById(id);
	}
	
	/**
	 * 分页展示外部用户对象
	 * @see com.kh.pajx.sop.base.BaseServiceImpl#getPageBean(int, int, com.kh.pajx.sop.util.page.QueryHelper)
	 */
	@Override
	public PageBean getPageBean(int pageNum, int pageSize,
			QueryHelper queryHelper) {
		return sysOutsideUserDao.getPageBean(pageNum, pageSize, queryHelper);
	}
	
	@Override
	public List<SysOutsideUser> getUserByRoleCode(String roleCode) {
		return sysOutsideUserDao.getUserByRoleCode(roleCode);
	}
	
	@Override
	public List<SysOutsideUser> getUserByRoleCode(String roleCode,int flag) {
		return sysOutsideUserDao.getUserByRoleCode(roleCode,flag);
	}
	
	
	@Override
	public long countUserByRoleCode(String usrCode) {
		return sysOutsideUserDao.countUserByRoleCode(usrCode);
	}

	@Override
	public List<SysOutsideUser> getUserByCountyCode(String countyCode,
			int osuType, int statusFlag) {
		// TODO Auto-generated method stub
		return sysOutsideUserDao.getUserByCountyCode(countyCode,osuType, statusFlag);
	}

	@Override
	public List getSimpleUserByCountyCode(String countyCode, int osuType,
			int statusFlag) {
		// TODO Auto-generated method stub
		return sysOutsideUserDao.getSimpleUserByCountyCode(countyCode,osuType, statusFlag);
	}
}
